Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced ability to deploy ubuntu network configuration on edge server #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

henglikuang
Copy link

Note In the se350 v2 se455 v2 se360 v2, it is found that the network adapter is not up immediately when the machine is started, and it takes a period of time for all network adapters to change to lower_up. Therefore, a mechanism is added to wait for the status of the network adapter, traversing all network adapters, and monitoring each network adapter for 20 seconds

@henglikuang
Copy link
Author

I also noticed that on the edge server, there is a usb adapter in the interface list, which is always shown as LOWER_UP. Therefore, if there is at least one lower_up, then we proceed to configure the l3 network which does not work in this case.
edge server

@@ -31,11 +27,37 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
MYGW=""
fi
MYNM=$(grep ^ipv4_netmask: $tcfg | awk '{print $2}')
for NICGUESS in $(ip link|grep LOWER_UP|grep -v LOOPBACK|cut -d ' ' -f 2 | sed -e 's/:$//'); do
for NICGUESS in `ls /sys/class/net/`; do
if [ -n "$(ip link show "$NICGUESS" | grep "LOOPBACK")" ]; then
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this line to avoid check lo nic

@jjohnson42
Copy link
Member

jjohnson42 commented Apr 17, 2024

I'm still curious, I gathter you want to wait up to 20 seconds for link to negotiate, but does it really have to be one at a time? In this scenario I'd wonder if the original 'link up all the nics at once' behavior is still sufficient, but with a loop to loop the nic iteration:
diff --git a/confluent_osdeploy/ubuntu22.04/initramfs/scripts/init-premount/confluent b/confluent_osdeploy/ubuntu22.04/initramfs/scripts/init-premount/confluent
index 03761f3a..8beb805e 100755

--- a/confluent_osdeploy/ubuntu22.04/initramfs/scripts/init-premount/confluent
+++ b/confluent_osdeploy/ubuntu22.04/initramfs/scripts/init-premount/confluent
@@ -31,6 +31,7 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
             MYGW=""
         fi
         MYNM=$(grep ^ipv4_netmask: $tcfg | awk '{print $2}')
+        while [ -z "$NIC" ]; do
             for NICGUESS in $(ip link|grep LOWER_UP|grep -v LOOPBACK|cut -d ' ' -f 2 | sed -e 's/:$//'); do
                 ip addr add dev $NICGUESS $v4addr
                 if [ ! -z "$MYGW" ]; then
@@ -49,6 +50,7 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
                     break
                 fi
             done
+        done
         ipconfig -d $MYIP::$MYGW:$MYNM::$NIC
         echo $NIC > /tmp/autodetectnic
     else

@henglikuang
Copy link
Author

henglikuang commented Apr 18, 2024

As i mention, even if we have link up for all nics at before, we also need wait a servel times until their up. it not up immediately
If we use "IP link | grep LOWER_UP | grep -v LOOPBACK | the cut - d '- f 2 | sed -e' s / : $/ / '" to filter all of the available network card, we will not get the real card, Since it has a usb network card in the interface list and LOWER_UP always appears, so i have to be one at a time.

@ryanbowen
Copy link
Member

The more explicit way to do this is probably by filtering out any netdevs using the loopback or cdc_ether (and friends) drivers by checking /sys/class/net/$iface/device/driver, and waiting for link up on anything left. Unless you expect to actually ever use the USB nic for regular network traffic of course. I'm not familiar with these specific platforms but typically the USB nic is for inband BMC access as an alternative to ipmi via the Redfish HostInterface or equivalent.

@jjohnson42
Copy link
Member

On the matter of the one at a time, my hope was that the addition of the outer 'while' loop would address that issue, along with a few others. The problem as I saw was that there's only a single loop going through the interfaces. Problems that can happen to be aware of:
-Slow link up time
-Fast link up, but slow forwarding (e.g. spanning tree). In this case 20 seconds is not going to be enough
-An interface gets enumerated but is not viable for the specified network configuration (either gets enumerated first or has link first.
-Bonus, as referenced, the redfish host interface is a waste of time to consider, so it'd be nice to skip, as Ryan noted there could be a better way to do that. Fortunately, we have a somewhat better way to identify redfish host interface:

# dmidecode -t 42
Handle 0x0082, DMI type 42, 169 bytes
Management Controller Host Interface
        Host Interface Type: Network
        Device Type: USB
        idVendor: 0x04b3
        idProduct: 0x4010

Unfortunately this function may need to be fleshed out over time, since there are multiple ways for the record to indicate the NIC. For now, all my platforms gives us the usb vender and product id, and that can be used.

Since the existing for loop, in theory, should not be satisfied by mere 'link up' already, I was hoping that repeating the loop until a pass identifies a NIC it would get to the end game, and do so in a manner robust against all the scenarios.

@jjohnson42
Copy link
Member

I am wondering if:
2c9b526

Solves this.

It does not do anything with the host interface (no parsed DMI handy nor utility to parse it), but the impact is still hopefully mitigated by the repeat loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants